<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/EvalMap.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">EvalMap.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_eval_map_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2012-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#ifndef HELIB_EVALMAP_H</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#define HELIB_EVALMAP_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="_encrypted_array_8h.html">helib/EncryptedArray.h</a>&gt;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="matmul_8h.html">helib/matmul.h</a>&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; </div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classhelib_1_1_eval_map.html">   54</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_eval_map.html">EvalMap</a></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;{</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; ea;</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;  <span class="keywordtype">bool</span> invert;   <span class="comment">// apply transformation in inverse order?</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;  <span class="keywordtype">long</span> nfactors; <span class="comment">// how many factors of m</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;  std::unique_ptr&lt;BlockMatMul1DExec&gt; mat1;        <span class="comment">// one block matrix</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;  NTL::Vec&lt;std::unique_ptr&lt;MatMul1DExec&gt;&gt; matvec; <span class="comment">// regular matrices</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160; </div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  <a class="code" href="classhelib_1_1_eval_map.html#a1fb71a558b22ab7d4b6fa3611b1b6eaf">EvalMap</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; _ea,</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;          <span class="keywordtype">bool</span> minimal,</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;          <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; mvec,</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;          <span class="keywordtype">bool</span> _invert,</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;          <span class="keywordtype">bool</span> build_cache,</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;          <span class="keywordtype">bool</span> normal_basis = <span class="keyword">true</span>);</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;  <span class="comment">// the normal_basis parameter indicates that we want the</span></div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  <span class="comment">// normal basis transformation when invert == true.</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  <span class="comment">// On by default, off for testing</span></div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_eval_map.html#aed3f9a5dc25cc1b0afdac310958ae8c3">upgrade</a>();</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_eval_map.html#ad9044ba453e8fda4fc90cc55c3c68b5b">apply</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;};</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160; </div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160; </div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="classhelib_1_1_thin_eval_map.html">   87</a></span>&#160;<span class="keyword">class </span><a class="code" href="classhelib_1_1_thin_eval_map.html">ThinEvalMap</a></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;{</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;  <span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; ea;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;  <span class="keywordtype">bool</span> invert;   <span class="comment">// apply transformation in inverse order?</span></div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;  <span class="keywordtype">long</span> nfactors; <span class="comment">// how many factors of m</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  NTL::Vec&lt;std::unique_ptr&lt;MatMulExecBase&gt;&gt; matvec; <span class="comment">// regular matrices</span></div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160; </div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  <a class="code" href="classhelib_1_1_thin_eval_map.html#a10975ac9f3b5736badd6d6342be78cb9">ThinEvalMap</a>(<span class="keyword">const</span> <a class="code" href="classhelib_1_1_encrypted_array.html">EncryptedArray</a>&amp; _ea,</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;              <span class="keywordtype">bool</span> minimal,</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;              <span class="keyword">const</span> NTL::Vec&lt;long&gt;&amp; mvec,</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;              <span class="keywordtype">bool</span> _invert,</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;              <span class="keywordtype">bool</span> build_cache);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_thin_eval_map.html#a89f65f8b331fa6071e995db9749c9c97">upgrade</a>();</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classhelib_1_1_thin_eval_map.html#a3688e0126fc26aa205b65737b7ff7297">apply</a>(<a class="code" href="classhelib_1_1_ctxt.html">Ctxt</a>&amp; ctxt) <span class="keyword">const</span>;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;};</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160; </div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160; </div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="preprocessor">#endif // ifndef HELIB_EVALMAP_H</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclasshelib_1_1_eval_map_html_a1fb71a558b22ab7d4b6fa3611b1b6eaf"><div class="ttname"><a href="classhelib_1_1_eval_map.html#a1fb71a558b22ab7d4b6fa3611b1b6eaf">helib::EvalMap::EvalMap</a></div><div class="ttdeci">EvalMap(const EncryptedArray &amp;_ea, bool minimal, const NTL::Vec&lt; long &gt; &amp;mvec, bool _invert, bool build_cache, bool normal_basis=true)</div><div class="ttdef"><b>Definition:</b> EvalMap.cpp:42</div></div>
<div class="ttc" id="aclasshelib_1_1_thin_eval_map_html_a3688e0126fc26aa205b65737b7ff7297"><div class="ttname"><a href="classhelib_1_1_thin_eval_map.html#a3688e0126fc26aa205b65737b7ff7297">helib::ThinEvalMap::apply</a></div><div class="ttdeci">void apply(Ctxt &amp;ctxt) const</div><div class="ttdef"><b>Definition:</b> EvalMap.cpp:649</div></div>
<div class="ttc" id="aclasshelib_1_1_encrypted_array_html"><div class="ttname"><a href="classhelib_1_1_encrypted_array.html">helib::EncryptedArray</a></div><div class="ttdoc">A simple wrapper for a smart pointer to an EncryptedArrayBase. This is the interface that higher-leve...</div><div class="ttdef"><b>Definition:</b> EncryptedArray.h:1237</div></div>
<div class="ttc" id="aclasshelib_1_1_thin_eval_map_html_a10975ac9f3b5736badd6d6342be78cb9"><div class="ttname"><a href="classhelib_1_1_thin_eval_map.html#a10975ac9f3b5736badd6d6342be78cb9">helib::ThinEvalMap::ThinEvalMap</a></div><div class="ttdeci">ThinEvalMap(const EncryptedArray &amp;_ea, bool minimal, const NTL::Vec&lt; long &gt; &amp;mvec, bool _invert, bool build_cache)</div><div class="ttdef"><b>Definition:</b> EvalMap.cpp:509</div></div>
<div class="ttc" id="aclasshelib_1_1_thin_eval_map_html"><div class="ttname"><a href="classhelib_1_1_thin_eval_map.html">helib::ThinEvalMap</a></div><div class="ttdoc">Class that provides the functionality for the linear transforms used in &quot;thin&quot; boostrapping,...</div><div class="ttdef"><b>Definition:</b> EvalMap.h:88</div></div>
<div class="ttc" id="aclasshelib_1_1_eval_map_html"><div class="ttname"><a href="classhelib_1_1_eval_map.html">helib::EvalMap</a></div><div class="ttdoc">Class that provides the functionality for the linear transforms used in boostrapping....</div><div class="ttdef"><b>Definition:</b> EvalMap.h:55</div></div>
<div class="ttc" id="a_encrypted_array_8h_html"><div class="ttname"><a href="_encrypted_array_8h.html">EncryptedArray.h</a></div><div class="ttdoc">Data-movement operations on encrypted arrays of slots.</div></div>
<div class="ttc" id="aclasshelib_1_1_eval_map_html_ad9044ba453e8fda4fc90cc55c3c68b5b"><div class="ttname"><a href="classhelib_1_1_eval_map.html#ad9044ba453e8fda4fc90cc55c3c68b5b">helib::EvalMap::apply</a></div><div class="ttdeci">void apply(Ctxt &amp;ctxt) const</div><div class="ttdef"><b>Definition:</b> EvalMap.cpp:171</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="amatmul_8h_html"><div class="ttname"><a href="matmul_8h.html">matmul.h</a></div><div class="ttdoc">some matrix / linear algenra stuff</div></div>
<div class="ttc" id="aclasshelib_1_1_eval_map_html_aed3f9a5dc25cc1b0afdac310958ae8c3"><div class="ttname"><a href="classhelib_1_1_eval_map.html#aed3f9a5dc25cc1b0afdac310958ae8c3">helib::EvalMap::upgrade</a></div><div class="ttdeci">void upgrade()</div><div class="ttdef"><b>Definition:</b> EvalMap.cpp:163</div></div>
<div class="ttc" id="aclasshelib_1_1_ctxt_html"><div class="ttname"><a href="classhelib_1_1_ctxt.html">helib::Ctxt</a></div><div class="ttdoc">A Ctxt object holds a single ciphertext.</div><div class="ttdef"><b>Definition:</b> Ctxt.h:270</div></div>
<div class="ttc" id="aclasshelib_1_1_thin_eval_map_html_a89f65f8b331fa6071e995db9749c9c97"><div class="ttname"><a href="classhelib_1_1_thin_eval_map.html#a89f65f8b331fa6071e995db9749c9c97">helib::ThinEvalMap::upgrade</a></div><div class="ttdeci">void upgrade()</div><div class="ttdef"><b>Definition:</b> EvalMap.cpp:641</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
